package com.ask.forMe.service.impl;

import com.ask.forMe.mapper.GroupBuyActivityMapper;
import com.ask.forMe.model.entity.GroupBuyActivity;
import com.ask.forMe.service.GroupBuyActivityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class GroupBuyActivityServiceImpl extends ServiceImpl<GroupBuyActivityMapper, GroupBuyActivity> implements GroupBuyActivityService {
    /**
     * 商家发布拼团活动
     * @param groupBuyActivity
     */
    @Override
    public void publishGroupBuyActivity(GroupBuyActivity groupBuyActivity) {
        groupBuyActivity.setStartTime(LocalDateTime.now());
        groupBuyActivity.setEndTime(LocalDateTime.now().plusDays(7));
        groupBuyActivity.setStatus(GroupBuyActivity.STATUS_UNBEGIN);
        save(groupBuyActivity);
    }
}
